import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HashMapTest {
    public static void main(String[] args) {
        HashMap<Integer,String> hashMap = new HashMap<>() ;
        hashMap.put(1,"张三");
        hashMap.put(2,"lisi");
        hashMap.put(3,"qweqwe");
        hashMap.put(4,"aaa");
        Set<Integer> set = hashMap.keySet();
        for (Integer e : set) {
            System.out.println(e + "=" + hashMap.get(e));
        }
        System.out.println("=================================");
        Set<Map.Entry<Integer,String>> set1 =  hashMap.entrySet();
        //1
        Iterator<Map.Entry<Integer,String>> it = set1.iterator();
        while (it.hasNext()) {
            Map.Entry<Integer,String> e = it.next();
            System.out.println(e.getKey() + "=" + e.getValue());
        }
    }
}
